package com.allwees.bs.c.module.sys.repository;

import com.allwees.bs.c.module.base.repository.BaseRepository;
import com.allwees.bs.c.module.sys.entity.DivisionEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author maoxj
 * @since 2020-12-03
 */
public interface DivisionRepository extends BaseRepository<DivisionEntity, Integer> {
    @Query("FROM DivisionEntity WHERE layer=:layer AND divisionCode like :divisionCode%")
    List<DivisionEntity> findRegion(@Param("divisionCode") String divisionCode, @Param("layer") int layer);

    List<DivisionEntity> findByLayer(int layer);

}
